<?php

namespace Home\Service;

use Home\DAO\ExpressManDAO;

/**
 * 快递员 Service
 *
 * @author 李静波
 */
class ExpressManService extends PSIBaseService {

	/**
	 * 新增或编辑快递员
	 */
	public function editExpressMan($params) {
		if ($this->isNotOnline()) {
			return $this->notOnlineError();
		}
		
		$name = $params["name"];
		
		$ps = new PinyinService();
		$py = $ps->toPY($name);
		
		$params["py"] = $py;
		
		$dao = new ExpressManDAO();
		
		return $dao->editExpressMan($params);
	}

	/**
	 * 快递员列表
	 */
	public function expressManList($params) {
		if ($this->isNotOnline()) {
			return $this->emptyResult();
		}
		
		$dao = new ExpressManDAO();
		
		return $dao->expressManList($params);
	}

	/**
	 * 删除快递员
	 */
	public function deleteExpressMan($params) {
		if ($this->isNotOnline()) {
			return $this->notOnlineError();
		}
		
		$dao = new ExpressManDAO();
		
		return $dao->deleteExpressMan($params);
	}

	/**
	 * 快递员所属片区
	 */
	public function expressManDistrict($params) {
		if ($this->isNotOnline()) {
			return $this->emptyResult();
		}
		
		$dao = new ExpressManDAO();
		
		return $dao->expressManDistrict($params);
	}

	/**
	 * 获得某个快递员的信息
	 */
	public function expressManInfo($params) {
		if ($this->isNotOnline()) {
			return $this->emptyResult();
		}
		
		$dao = new ExpressManDAO();
		
		return $dao->expressManInfo($params);
	}

	public function queryData($params) {
		if ($this->isNotOnline()) {
			return $this->emptyResult();
		}
		
		$dao = new ExpressManDAO();
		
		return $dao->queryData($params);
	}
}